package com.dapeis.core.utils.json;

import java.lang.reflect.Type;

import com.dapeis.core.utils.StylistConstants;
import com.dapeis.domain.Collocation;
import com.dapeis.im.tim.TIMUtil;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

/**
 * 
 * Title:CollocationGsonAdapter.java CollocationGsonAdapter Description:
 * 
 * @author yuanyong
 * @date 2017年4月23日 下午7:51:36
 * 
 * Email: hzyuanyong@126.com
 *
 */
public class CollocationGsonAdapter implements JsonSerializer<Collocation> {

    @Override
    public JsonElement serialize(Collocation src, Type typeOfSrc,
	    JsonSerializationContext context) {
		JsonObject json = new JsonObject();
		json.addProperty("id", src.getId());
		json.addProperty("timId",TIMUtil.getDPSUserIdentifier(src.getId()));
		json.addProperty("headImg",StylistConstants.PASERIMGPATH(src.getHeadImg()));
		json.addProperty("nickName", src.getNickName());
		json.addProperty("qrCode", StylistConstants.PASERIMGPATH(src.getQrCodeUrl()));
		json.addProperty("backgroundImg", StylistConstants.PASERIMGPATH(src.getBackgroundImg()));
		json.addProperty("state", src.getState());
		json.addProperty("auditState", src.getAuditState());
		json.addProperty("honor", src.getHonor());
		json.addProperty("address", src.getAddress());
		json.addProperty("goodsStyle", src.getGoodStyle());
		return json;
    }
    
}
